/*
 * PlayerTableFile.h
 *
 *  Created on: Jul 25, 2013
 *      Author: Dan
 */

#ifndef PLAYERTABLEFILE_H_
#define PLAYERTABLEFILE_H_

#include "DataTableFile.h"
#include "Log.h"
#include "XMLTree.h"
#include "Reciept.h"

#include <string>
#include <fstream>
#include <sstream>
#include <cstdio>

namespace sm {

class PlayerTableFile: public sm::DataTableFile {
private:
	std::string readUID(std::string&);
	std::string readName(std::string&);
	std::string readPass(std::string&);
	int addPlayer(const std::string&, const std::string&, const std::string&);
	int rmPlayer(const int&);
	int changePassword(const int&, const std::string&);
	std::string listPlayers();
	std::string listtoxml(const std::string&);
public:
	PlayerTableFile(const std::string&);
	std::string getPassword(const int&);
	std::string getName(const int&);
	Reciept* createreceipt(monkeyXML::XMLTree&);
	virtual ~PlayerTableFile();

	static int SUCCESS;
	static int PLAYERUIDEXISTS;
	static int ERROROPENINGFILE;
	static int PLAYERNOTFOUND;
	static int UNABLETOSWAP;
	static int BADXML;
};

} /* namespace monkeyXML */
#endif /* PLAYERTABLEFILE_H_ */
